// pages/check/card/card.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		data: [],
		pg:1,
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onShow: function(options) {
		wx.getStorage({
			key: 'uid',
			success: (e) => {
				this.setData({
					uid: e.data.uid,
					data:[]
				})
				this.push()
			}
		})

	},
	push() {
		let a = this.data.data
		wx.request({
			url: getApp().globalData.chang + 'action=getOfflineSale&uid=' + this.data.uid+'&pg='+this.data.pg,
			success: (e) => {
				console.log(e)
				e.data.data.forEach(function(item,index) {
					a.push(item)
				}) 
				let pd = 1
				if (e.data.data.length < 15) {
					pd = 0
				}
				this.setData({
					data: a,
					pd: pd
				})
				console.log(a)
			}
		})
	},
	ovo() {
		if (this.data.pd == 'false') {
			let a = this.data.pg + 1
			this.setData({
				pg: a
			})
			this.push()
		}
	},
})
